package com.example.blades.mylogactivity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class LogActivity extends AppCompatActivity {
    private Button myButton;
    static final String LIFE_TAG="LogActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_log);
        Log.v(LogActivity.LIFE_TAG,"FirstActivity ---> onCreate");
        Button myButton=(Button)findViewById(R.id.myButton);
        myButton.setText("启动第二个Activity");
        myButton.setOnClickListener(new ButtonOnClickListener());
    }

    class ButtonOnClickListener implements View.OnClickListener {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setClass(LogActivity.this, LogActivity3.class);
            LogActivity.this.startActivity(intent);
        }

    }

        @Override
        protected void onDestroy()
        {
            Log.v(LogActivity.LIFE_TAG,"FirstActivity ---> onDestroy");
            super.onDestroy();
        }

        @Override
        protected void onRestart()
        {
            Log.v(LogActivity.LIFE_TAG,"FirstActivity ---> obRestart");
            super.onRestart();
        }

        @Override
        protected void onResume()
        {
            Log.v(LogActivity.LIFE_TAG,"FirstActivity ---> obResume");
            super.onResume();
        }

        @Override
        protected void onStart()
        {
            Log.v(LogActivity.LIFE_TAG,"FirstActivity ---> onStart");
            super.onStart();
        }

        @Override
        protected void onStop()
        {
            Log.v(LogActivity.LIFE_TAG,"FirstActivity ---> onStop");
            super.onStop();
        }

    @Override
    protected void onPause()
    {
        Log.v(LogActivity.LIFE_TAG,"FirstActivity ---> onPause");
        super.onPause();
    }

}
